﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace slwhTools.FileHelper
{
    public class SFileConfig:ISFileConfig
    {
        /// <summary>
        /// 初始化信息
        /// </summary>
        public void Init()
        {
            string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
            var directoryPath = Path.Combine(baseDirectory, ISFileConfig.DefaultFileDicName);
            //如果不存在保存目录直接设置默认保存目录
            if (string.IsNullOrEmpty(ISFileConfig.SavePath))
            {
                if (!Directory.Exists(directoryPath))
                {
                    Directory.CreateDirectory(directoryPath);
                
                }
            }
            ISFileConfig.SavePath = directoryPath;
            ISFileConfig.MaxFileSize = ISFileConfig.MaxFileSize * 1024 * 1024;
        }
    }
}
